



<!-- 新 Bootstrap 核心 CSS 文件 -->
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">


<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>


<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script language="javascript" type="text/javascript" src="/assets/libs/fastadmin-layer/dist/layer.js"></script>
<style>
    body{
        color: #3b3b3b;
    }

    .mask {
        position: absolute; top: 0px; filter: alpha(opacity=90); background-color: #000;
        z-index: 1000; left: 0px;
        opacity:0.9; -moz-opacity:0.9;
    }
    .day{
        padding-left: 30px;
        color: #3b3b3b;
        margin-top: 20px;
    }
    .icon1{
        float: left;
        width: 50px;
        height: 59px;
        background-image: url("/assets/img/new1/tr/1.png");
        color: #ffffff;
        text-align: center;
        padding-top: 10px;
        font-size: 18px;

    }

    .daytitle{
        margin-left: 30px;
        padding-top: 10px;
        padding-left: 50px;
    }

    .infoicon{
        float: left;
        width: 30px;
        height: 30px;
        border-radius:5px;
        background-color: #93cfff;
        margin-left: 10px;
    }


    .dn{
        font-size: 20px;
        font-weight: bolder;
        padding-right: 40px;
    }
    .dt1{
        font-size: 16px;
        font-weight: bolder;
    }
    .ddt1{
        font-size: 16px;
        font-weight: bolder;
    }
    .dinfo{
        margin-top: 20px;
    }

    .infotitle{
        font-size: 16px;
        font-weight: bolder;
        line-height: 16px;
        padding-top: 10px;
        padding-left: 50px;
    }
    .infocontent{
        font-size: 15px;
        line-height: 22px;
        padding-top: 10px;
        padding-left: 50px;
    }
    .infoimg{
        padding-left: 50px;
    }


    #editday,#addday{
        position: absolute;
        margin-left: 30px;
        display: none;
        background-color: #fff;
        z-index: 1001;
        height: 200px;
        line-height: 40px;
        width: 600px;
        padding-left: 20px;
    }

    #addimg{
        position: absolute;
        margin-left: 30px;
        display: none;
        background-color: #fff;
        z-index: 1001;
        height: 400px;
        line-height: 40px;
        width: 900px;
        padding-left: 20px;
    }



    #addinfo{
        position: absolute;
        margin-left: 30px;
        display: none;
        background-color: #fff;
        z-index: 1001;
        height: 700px;
        line-height: 40px;
        width: 900px;
        padding-left: 20px;
    }


    #delday1{
        position: absolute;
        margin-left: 80px;
        display: none;
        background-color: #fff;
        z-index: 1001;
        height: 200px;
        line-height: 40px;
        width: 500px;
        padding-left: 20px;
    }

    #delinfo1{
        position: absolute;
        margin-left: 80px;
        display: none;
        background-color: #fff;
        z-index: 1001;
        height: 200px;
        line-height: 40px;
        width: 500px;
        padding-left: 20px;
    }

    .iday{
        width: 80px;
        height: 40px;
        border-top: none ;
        border-left: none ;
        border-right: none ;
        border-bottom: #0d95e8 1px dashed;
        font-size: 16px;
        font-weight: bolder;
    }
    .img1{
        float: left;
    }
    .ds1{
        float: left;
    }
    #editt1,#addt1{
        text-align: center;
    }
    .del1{
        font-size: 13px;
    }
    #edui2 div{
        height: 20px;
    }


    .suggestionsBox {
        position: relative;
        width: 300px;
        background-color: #252525;
        color: #fbfcff;
    }
    .suggestionList {
        margin: 0px;
        padding: 0px;
        position: absolute;
        background-color: #414141;
        z-index: 1210;
    }
    .suggestionList li {

        margin: 0px 0px 0px 0px;
        padding: 3px;
        cursor: pointer;
    }

    .suggestionList li:hover {
        background-color: #659CD8;

    }
    #inputString{
        height:30px;
        wight:130px;
    }
    #info_title{
        font-size: 16px;
        font-weight:bolder;
        line-height: 16px;
    }
    .all {
        width:100px;
        height:30px;
        float:left;
    }
    .all li {
        width:100px;
        height:30px;
        line-height:20px;
        text-align:center;
        float:left;
        display:inline;
        position:relative;
        cursor:pointer;
        left:-40px;
        top:-7px;
    }
    .allli{
        width:100px;
        height:30px;
        line-height:20px;
        text-align:center;
        float:left;
        display:inline;
        position:relative;
        cursor:pointer;
        left:-40px;
        top:-7px;
    }
    .all ul {
        position:absolute;
        left:0;
        top:30px;
        display:none;
    }
</style>


<script language="JavaScript">



    function lookup(inputString) {
        cus=-1;
        if(inputString.length == 0) {
            // Hide the suggestion box.
            $('#suggestions').hide();
        } else {
            $.post("/admin/command/getplace", {queryString: ""+inputString+""}, function(data){
                if(data.length >0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);
                }
            });
        }
    } // lookup

    function aa (){

        if(document.activeElement.id!="inputString"){

            if(document.activeElement.id!="inputString1"){
                setTimeout("$('#suggestions').hide();", 200);
            }
        }
    }

    function fill(obj) {

        console.log($(obj).html()+"##########");
        $('#inputString').val($(obj).html());
        $("#pinfo").html($(obj).attr("pcontent"))
        $("#info_linkid").val($(obj).attr("placeid"))
        $("#info_title").val($(obj).attr("pname"))
        //setTimeout("aa()",200);

    }
    function fill1(thisValue) {
        setTimeout("aa()",200);
    }

    //全局定义 当前选择的li数组下标

    var cus=-1;
    function sitem(event,obj){

//获取所有选项li
        var liarr=$("#autoSuggestionsList").find("li")
        //向上
        if (event.keyCode == 38) {
            $("#inputString1").focus();
            if(-1>cus){
                cus=liarr.length-2;
            }
            cus--;
            $("#autoSuggestionsList").find("li").css("background-color","#252525");
            $(liarr[cus]).css("background-color","#659CD8");
            $("#inputString").val($(liarr[cus]).html())
            $("#inputString1").val($(liarr[cus]).html())
        }

        //向下
        if(event.keyCode == 40){
            $("#inputString1").focus();
            if(cus>liarr.length-2){
                cus=-1;
            }
            cus++;
            $("#autoSuggestionsList").find("li").css("background-color","#252525");
            $(liarr[cus]).css("background-color","#659CD8");
            $("#inputString").val($(liarr[cus]).html())
            $("#inputString1").val($(liarr[cus]).html())
        }
        //回车
        if(event.keyCode == 13){
            console.log($(liarr[cus]).attr("placeid")+"@@@@@@@@");

            $("#inputString").val($(liarr[cus]).html())
            $("#inputString1").val($(liarr[cus]).html())
            $("#pinfo").html($(liarr[cus]).attr("pcontent"))
            $("#info_linkid").val($(liarr[cus]).attr("placeid"))
            $("#info_title").val($(liarr[cus]).attr("pname"))

            $("#inputString").focus();
            cus=-1;
        }




    }

</script>

<div id="toolbar" class="toolbar">

    <div id="mask" class="mask" onclick="hideMask()"></div>
    <!--addimg 开始-->
    <div id="addimg">
        <div class="page-breadcrumbs">
            <p style="color: red;text-align: center">图片限定： 宽 450px  高 270px</p>
        </div>
        <div class="widget">
            <div class="widget-body">
                <div id="horizontal-form">
                    <form id="f1" class="form-horizontal" role="form" action="/admin/product/route_info_img_add" method="post" enctype="multipart/form-data">
                        <input type="hidden" name="p_id" id="p_id">
                        <input type="hidden" name="tr_id" id="tr_id">
                        <input type="hidden" name="tri_id" id="tri_id">
                        <input name="uploadfile" id="pic" class="txt_form" type="file">
                        <img src="" alt="" id="lod_pic" >
                        <input id="uploadimg" type="submit" onclick="" value="上传"/>
                        <script language="JavaScript">
                            $('#pic').change(function(){
                                var path = $(this).val(),
                                    extStart = path.lastIndexOf('.'),
                                    ext = path.substring(extStart,path.length).toUpperCase();
                                if(ext !== '.PNG' && ext !== '.JPG' && ext !== '.JPEG' && ext !== '.GIF'){
                                    alert('请上传正确格式的图片');
                                    return false;
                                }
                                var file = this;
                                createReader(file.files[0], function (w, h, u) {
// alert(w + ' '+ h +' '+u);
                                    $('#lod_pic').attr("src",u);
                                    if(w!=450||h!=270){
                                        alert('图片必须为宽450px,高270px');
                                        $('#f1')[0].reset();
                                        $('#lod_pic').attr('src','');
                                        return false;
                                    }
                                    $('#pic_info').text("（图片尺寸："+w+"x"+h+"）"+ext);
                                });
                            })
                            createReader = function(file, whenReady) {
                                var reader = new FileReader;
                                reader.onload = function (evt) {
                                    var image = new Image();
                                    image.onload = function () {
                                        var pic_url = this.src;
                                        var width  = this.width;
                                        var height = this.height;
                                        if (whenReady) whenReady(width, height , pic_url);
                                    };
                                    image.src = evt.target.result;
                                };
                                reader.readAsDataURL(file);
                            }
                        </script>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!--addimg 结束-->







    <!--addday开始-->

    <div id="addday" class="addday">

        <div id="addt1" class="dn"></div>
        <span id="addt2" class="dn"></span>
        <div style="clear: both"></div>
        <form name="addday1" action="/admin/product/route_add" method="post">
            <input type="hidden" name="p_id" value="{$p_id}"/>
            <input type="hidden" name="titlearr" value=""/>
            <input type="hidden" name="day_no" value="">
            <button type="submit" class="btn btn-success">确定添加</button>
            <a id="at1">
                <span class="stext" onclick="dtop(1,0,'','addt2')">标题文字</span>
                <span class="simg" onclick="dtop(1,0,1,'addt2')"><img src="/assets/img/new1/title/1.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,2,'addt2')"><img src="/assets/img/new1/title/2.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,3,'addt2')"><img src="/assets/img/new1/title/3.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,4,'addt2')"><img src="/assets/img/new1/title/4.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,5,'addt2')"><img src="/assets/img/new1/title/5.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,6,'addt2')"><img src="/assets/img/new1/title/6.png" width="30"></span>

            </a>
        </form>
    </div>

    <!--addday结束-->




    <!--editday开始-->

    <div id="editday" class="editday">

        <div id="editt1" class="dn"></div>
        <span id="editt2" class="dn"></span>
        <div style="clear: both"></div>
        <form name="editday1" action="/admin/product/route_edit" method="post">
            <input type="hidden" name="p_id" value="{$p_id}"/>
            <input type="hidden" name="tr_id" value=""/>
            <input type="hidden" name="titlearr" value=""/>
            <input type="hidden" name="day_no" value="">
            <button type="submit" class="btn btn-success">确定修改</button>
            <a id="et1">
                <span class="stext" onclick="dtop(1,0,'','editt2')">标题文字</span>
                <span class="simg" onclick="dtop(1,0,1,'editt2')"><img src="/assets/img/new1/title/1.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,2,'editt2')"><img src="/assets/img/new1/title/2.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,3,'editt2')"><img src="/assets/img/new1/title/3.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,4,'editt2')"><img src="/assets/img/new1/title/4.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,5,'editt2')"><img src="/assets/img/new1/title/5.png" width="30"></span>
                <span class="simg" onclick="dtop(1,0,6,'editt2')"><img src="/assets/img/new1/title/6.png" width="30"></span>

            </a>
        </form>
    </div>

    <!--editay结束-->



    <!--delday开始-->

    <div id="delday1" class="delday1">

        <form action="/admin/product/route_delday" method="post">
            <input type="hidden" id="delid" name="id" value=""/>
            <input type="hidden" name="p_id" value="{$p_id}"/>
            <div><span id="deld1" class="dn"></span><span id="deld2" class="ddt1"></span></div>
            <input style="width:200px" type="submit" class="btn btn-success btn-block" value="确认删除"/>
        </form>
    </div>

    <!--delday结束-->


    <!--addinfo开始-->

    <div id="addinfo" class="addinfo">

        <form action="/admin/product/route_info_add" method="post" id="infosub1">
            <input type="hidden" id="infoopid" name="id" value="{$p_id}"/>

            <input type="hidden" name="p_id" value="{$p_id}"/>
            <input type="hidden" id="info_op" name="op" value=""/>
            <input type="hidden" id="info_tr_id" name="tr_id" value=""/>
            <input type="hidden" id="info_itype" name="itype" value=""/>
            <input type="hidden" id="info_tagid" name="tagid" value=""/>
            <input type="hidden" id="info_content" name="info" value=""/>
            <input type="hidden" id="info_linkid" name="linkid" value=""/>
            <input type="hidden" id="info_sort" name="sort" value=""/>
            <input type="hidden" id="info_infotime" name="infotime" value=""/>


            <div id="splace">
                选择景点 <input type="text" size="30" value="" id="inputString" onfocus="lookup(this.value);" onkeyup="lookup(this.value);" onblur="fill1();"  onkeydown="sitem(event,this)" autocomplete="off"/>

                <div style="width: 0px; height: 0px; overflow: hidden"><input  type="text" size="30" value="" id="inputString1" onkeydown="sitem(event,this)" onblur="fill1();" autocomplete="off"/></div>

                <div class="suggestionsBox" id="suggestions" style="display: none;">
                    <div class="suggestionList" id="autoSuggestionsList">
                        &nbsp;
                    </div>
                </div>
            </div>
            <input class="input-box"  id="info_title" type="text" name="title" placeholder="内容标题" value="">
            <script id="editor" type="text/plain" style="width:800px;height:300px;"></script>
            <script type="text/javascript">
            //实例化编辑器
            //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
            var ue = UE.getEditor('editor');
            </script>
            <div id="pinfo" style="height: 100px; overflow: auto"></div>
            <input onclick="infosub()" style="width:200px" type="button" class="btn btn-success btn-block" value="确认"/>

            <div class="infoicon"><img src="/assets/img/new1/infoicon/1.png" width="10"></div>
        </form>
    </div>

    <!--addinfo结束-->






</div>



<div>

    {foreach name="list" item="vo"}
    <div class="day">
        <div class="icon1">D{$vo['day_no']}</div>
        <!--定义锚用于跳转-->
        <a name="dno{$vo['id']}"></a>
        <div class="daytitle">
            <span class="dn">第<span class="daytos">{$vo['day_no']}</span>天</span>
            <span class="dt1" stitle="{$vo['titlearr']}">{$vo['titlearr']}</span>
            <div>

                <ul>


                    <li href="javascript:void(0)" onclick="showaddday({$vo['day_no']})" class="btn btn-success btn-add" title="插入一天"><i class="fa fa-plus"></i>&nbsp;插入一天</li>

                    <li  href="javascript:void(0);" onclick="delday({$vo['id']})" class="btn btn-danger btn-del" title="删除本日"><i class="fa fa-trash"></i> 删除本日</li>
                    <li href="javascript:void(0)" onclick="showeditday('{$vo['titlearr']}',{$vo['id']},{$vo['day_no']})" class="btn btn-success btn-edit " title="编辑标题"><i class="fa fa-pencil"></i> 编辑标题</li>
                    <li class="btn btn-success btn-add" style="height: 31px">
                        <ul class="all">
                            <li style="line-height: 30px;"><i class="fa fa-plus"></i>&nbsp;插入行程内容<br/>
                                <ul>
                                    <?php for($i=1;$i<9;$i++){

?>
                                    <li style='top:0px' class='btn btn-success btn-add' onclick="showaddinfo({$vo['id']},'<?php echo getstr("route_info-itype",$i)?>','{$i}','{$i}')">
                                    <?php echo getstr("route_info-itype",$i)?>
                                    </li>

                                    <?php }?>
                                </ul>
                            </li>
                        </ul>
                    </li>
                    {if condition="$vo['day_no'] gt 1"}
                    <li href="javascript:void(0)" onclick="route_move('{$vo.id}','{$vo.p_id}','{$vo.package_id}','{$vo.day_no}','1');" class="btn btn-success btn-add" title="向前一天">&nbsp;向前一天</li>
                    {/if}
                    {if condition="$count neq $vo['day_no']"}
                    <li href="javascript:void(0)" onclick="route_move('{$vo.id}','{$vo.p_id}','{$vo.package_id}','{$vo.day_no}','2');" class="btn btn-success btn-add" title="向后一天">&nbsp;向后一天</li>
                    {/if}
                </ul>




            </div>
        </div>
        <div style="clear: both"></div>
        {foreach name="vo['darr']" item="vo1"}

        <div class="dinfo">
            <div class="infoicon"><img src="/assets/img/new1/infoicon/1.png" width="30"></div>
            <div class="infotitle">

                <?php
         if($vo1['itype']==7){
         echo "景点";
         }
           ?>
                &nbsp;&nbsp;{$vo1['title']}
            </div>
            <!--定义锚用于跳转-->
            <a name="dinfo{$vo1['id']}"></a>
            <div>




                <a href="javascript:void(0);"  onclick="delinfo({$vo1['id']})" class="btn btn-xs btn-danger btn-delone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="9" data-row-index="0" data-button-index="2" data-original-title="删除"><i class="fa fa-trash"></i></a>

              <a href="javascript:void(0);" onclick="showeditinfo({$vo1['id']});"class="btn btn-xs btn-success btn-editone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="9" data-row-index="0" data-button-index="1" data-original-title="编辑"><i class="fa fa-pencil"></i></a>

               <!-- <a href="javascript:void(0);" onclick="showaddinfo(1,{$vo['id']},'{$vo1['title']}','<?php echo htmlspecialchars($vo1['info']); ?>','{$vo1['itype']}','{$vo1['linkid']}','{$vo1['sort']}','{$vo1['tagid']}','{$vo1['infotime']}','{$vo1['id']}')"class="btn btn-xs btn-success btn-editone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="9" data-row-index="0" data-button-index="1" data-original-title="编辑"><i class="fa fa-pencil"></i></a>-->

            </div>
            <div style="clear: both"></div>
            <div class="infocontent">
                {$vo1['info']}
            </div>
            <form  method="post" action="/admin/product/route_sort_img">
                <input type="hidden" name="p_id" value="{$p_id}">
                <input type="hidden" name="tr_id"   value="{$vo1['id']}">
                <input type="hidden" name="tri_id" value="{$vo['id']}">
                <input type="hidden" name="package_id" value="{$vo['package_id']}">
                <div class="infoimg">
                    {foreach name="vo1['infoimg']" item="vo2"}

                    <div class="img1">
                      <!-- <img  src="{$vo2['imgadr']}_200x120" />-->
                         <img  src="{$vo2['imgadr']}" width="200" height="120" />
                        <br/>
                        <a href="javascript:void(0);" onclick="delSingleInfo({$vo2['id']})" class="btn btn-xs btn-danger btn-delone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="9" data-row-index="0" data-button-index="2" data-original-title="删除"><i class="fa fa-trash"></i></a>
                        <br/>
                        排序 <input type="text" class="" size="1" name="imgsort[{$vo2['id']}]" value="{$vo2.imgsort}"/> <br/> 标题 <input type="text" class="" size="12" name="imgtitle[{$vo2['id']}]" value="{$vo2.imgtitle}"/>
                    </div>


                    {/foreach}
                    <div href="javascript:void(0)" onclick="showaddimg({$p_id},{$vo1['id']},{$vo['id']})" class="btn btn-success btn-add" title="添加图片"><i class="fa fa-plus"></i>&nbsp;添加图片</div>
                    {if condition="$vo1['itype'] eq 7"}
                    <div href="javascript:void(0)" onclick="select_img({$vo1['id']},{$p_id},{$vo['id']})" class="btn btn-success btn-add" title="图片库选取"><i class="fa fa-plus"></i>&nbsp;图片库选取</div>
                    {/if}
                    <div href="javascript:void(0)" onclick="sub_sort({$p_id},{$vo1['id']},{$vo['id']},this)" class="btn btn-success btn-add" title="提交">提交</div>
                    <div style="clear: both"></div>
                </div>
            </form>

        </div>


        {/foreach}


    </div>
    {/foreach}
</div>

<div style="margin-top:20px;" class="day1">

     <a href="javascript:void(0)"  onclick="showaddday(0)" class="btn btn-success btn-add" title="添加"><i class="fa fa-plus"></i> 增加一天</a>


</div>

<script language="JavaScript">

    //天数标题字符串 需要根据"#"分割成数组操作
    var dts="";
    //天数标题数组
    var dtsarry= new Array();

    //需要与遮罩同时隐藏的divid
    var hdiv="";

    var dnum=0;
    $(document).ready(function () {

        $('.all>li').hover(function(e) {
            $(this).children().stop().slideToggle()
        });



        //页面加载完成后指定标签将数字天 改为汉字天数

        $(".daytos").each(function(){
            $(this).html(ntos($(this).html()))
        })
        //页面加载完成后修改天数标题
        $(".dt1").each(function(){
            showtitle(this,$(this).attr("stitle"));
        })
    })

    //个位数，转汉字只处理两位数以内
    function ntos(num){

        var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];

        if(parseInt(num)<10){
            return (chnNumChar[parseInt(num)]);
        }else{
            //console.log(num)
            var lc=num.toString().slice(1)
            return ("十"+chnNumChar[parseInt(lc)]);
        }



    }
    //新增一天  day_no=0  是新增一天  ！=0  是插入一天
    function showaddday(day_no){

        var p_id="{$p_id}";
        var package_id="{$package_id}";
        var day_num='';
        if(day_no==0){
            dnum=$(".day").length;
            day_num=dnum+1;
        }else{
            day_num=day_no;
        }
        var url="/admin/product/route_add?day_no="+day_num+"&p_id="+p_id+"&package_id="+package_id;
       // alert(url);
        layer.open({
            type: 2,
            title:"第"+ntos(day_num)+"天标题设置",
            shift: 2,
            area: ['100%', '100%'],
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条

        });




    }

    //修改一天     标题  day_no=0  是新增一天  ！=0  是插入一天
    function showeditday(titletext,trid,day_no){

      var p_id="{$p_id}";
        var url="/admin/product/route_edit?p_id="+p_id+"&title="+titletext+"&trid="+trid;
         //alert(url);
        layer.open({
            type: 2,
            title:"第"+ntos(day_no)+"天标题修改",
            shift: 2,
            area: ['100%', '100%'],
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条

        });


    }


    //根据参数操作，op1--操作 1-增加 2-删除 3-修改  no1-数组下标  value1-值
    // 并根据字段输出相应input,字符串用#分割
    function dtop(op1,no1,value1,objname){
        console.log(objname+"###########");
        console.log($("#"+objname).html());
        if(op1==1){
            dtsarry[dtsarry.length]=value1;
        }
        if(op1==2){

            dtsarry[no1]=value1;
        }
        if(op1==3){
            dtsarry.splice(no1,1);
        }
        dts = dtsarry.join('*');
        if(objname=="editt2"){
            document.editday1.titlearr.value=dts;
        }
        if(objname=="addt2"){
            document.addday1.titlearr.value=dts;
        }

        stinput(objname)

        //$("#at1").hide();
    }

    // 根据字符串输出相应input,字符串用#分割--用于编辑

    function stinput(objname){
        var stout="";
        var objname1='"'+objname+'"';
        for(var i=0;i<dtsarry.length;i++){
            if(!isNaN(dtsarry[i])&&dtsarry[i]!=""){
                stout=stout+"<div class='ds1'><div><img width='30' src='/assets/img/new1/title/"+dtsarry[i]+".png'></div><div class='del1' onclick='dtop(3,"+i+","+1+","+objname1+")'><a href='javascript:;' class='btn btn-xs btn-danger btn-delone' data-original-title='删除'><i class='fa fa-trash'></i></a></div>"+"</div>"
            }else{
                var aa="this.value";
                //根据内容设定input宽度
                var iw=dtsarry[i].length*17
                if(iw==0){
                    iw=50;
                }
                stout=stout+"<div class='ds1'><div>" +
                    "<input style='width: "+iw+"px' onchange='dtop(2,"+i+","+aa+","+objname1+")' class='iday' type='text' value='"+dtsarry[i]+"'/>" +
                    "</div><div class='del1' onclick='dtop(3,"+i+","+1+","+objname1+")'><a href='javascript:;' class='btn btn-xs btn-danger btn-delone' data-original-title='删除'><i class='fa fa-trash'></i></a></div></div>"
            }
        }
        $("#"+objname).html(stout);

    }

    // 根据字符串输出相应文字图像效果，用于展示
    function showtitle(obj,titletxet){
        // var titletext=$(obj).attr("stitle");
        var titletext=titletxet;
        var dtsarry=titletext.split('*')
        //alert(dtsarry);
        var stout="";
        for(var i=0;i<dtsarry.length;i++){
            if(!isNaN(dtsarry[i])&&dtsarry[i]!=""){
                stout=stout+"<img width='30' src='/assets/img/new1/title/"+dtsarry[i]+".png'>"
            }else{
                stout=stout+dtsarry[i]
            }
        }
        $(obj).html(stout);
    }


    //删除一天
    function delday(id){
        //alert(id);
        layer.confirm('您要删除当前所选项目？', {btn: ['确定', '取消'], title: "提示"},function(){
            $.ajax({
                type:'post',
                dataType:'json',
                url:"/admin/product/route_info_del",
                data:{"id":id},
                success:function(data){
                    if(data==1){
                        window.location.reload();
                    }else{
                        layer.closeAll();
                    }
                }
            })
        })

    }

    //参数 1.optype  0-新增 1-修改   2 trid --行程天数id  3 infotitle-标题  4 infotext-内容  5 itype-信息类别  0为未选择
    // 6 linkid--外链或景点id  7 sort--排序  8--tagid 标记id  9-infotime 10-记录id 行程内容起始时间
    function showaddinfo(trid,infotitle,itype,tagid){

        var url="/admin/product/route_info_add?trid="+trid+"&infotitle="+infotitle+"&itype="+itype+"&tagid="+tagid;
        //alert(url);
        layer.open({
            type: 2,
            title:"添加信息",
            shift: 2,
            area: ['100%', '100%'],
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条

        });
    }

    function showeditinfo(id){
        var url="/admin/product/route_info_edit?id="+id;
        //alert(url);
        layer.open({
            type: 2,
            title:"修改信息",
            shift: 2,
            area: ['100%', '100%'],
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条

        });

    }



    //信息类别按钮点击


    function sinfotype(itypeno,tinfotitle,tagid){

        $("#info_itype").val(itypeno);
        $("#info_title").val(tinfotitle);
        $("#info_tagid").val(tagid);


    }


    //信息提交
    function infosub(){

        $("#info_content").val(UE.getEditor('editor').getContent());
        $("#infosub1").submit();
    }


    function delinfo(id){
        //alert(id);
        layer.confirm('您要删除当前所选信息？', {btn: ['确定', '取消'], title: "提示"},function(){
            $.ajax({
                type:'post',
                dataType:'json',
                url:"/admin/product/del_info",
                data:{"id":id},
                success:function(data){
                    if(data==1){
                        window.location.reload();
                    }else{
                        layer.closeAll();
                    }
                }
            })
        })

    }

    //新增图像
    function showaddimg(p_id,tr_id,tri_id){
        var flag=1;
        var url="/add_img.php?p_id="+p_id+"&tr_id="+tr_id+"&tri_id="+tri_id+"&flag="+flag;
        // alert(url);
        layer.open({
            type: 2,
            title:"裁切图片",
            shift: 2,
            area: ['100%', '100%'],
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条

        });

    }
    function sub_sort(p_id,tr_id,tri_id,obj) {
        $(obj).parent().parent().submit();
    }
    function delSingleInfo(id) {
        $.ajax({
            type:'post',
            dataType:'json',
            url:'/admin/product/delSingInfo',
            data:{"id":id},
            success:function(data){
                if(data==1){
                    layer.alert("图片删除成功",{
                        skin: 'layui-layer-molv',//样式类名,
                        closeBtn: 0,
                    },function(){
                        window.location.reload();
                    });
                }else{
                    layer.alert("图片删除失败");
                }
            }
        })

    }

    function select_img(route_info_id,pid,day_no){
        var url="/admin/product/product_gallery?route_info_id="+route_info_id+"&pid="+pid+"&day_no="+day_no;
        //alert(url);
        layer.open({
            type: 2,
            title:"图库图片选择",
            shift: 2,
            area: ['100%', '100%'],
            content: [url],
            scrollbar: true ,//屏蔽浏览器滚动条

        });
    }
</script>

<script>
    function route_move(id,pid,package_id,day_no,flag){
        $.ajax({
            type:'post',
            dataType:'json',
            url:'/admin/product/product_route_move',
            data:{"id":id,"pid":pid,"package_id":package_id,"day_no":day_no,"flag":flag},
            success:function(data){
                if(data.status==1){
                    window.location.reload();
                }else{
                    alert(data.message);
                }
            }
        })
    }

    function route_down(id,pid,package_id,day_no){
        $.ajax({
            type:'post',
            dataType:'json',
            url:'/admin/product/product_route_down',
            data:{"id":id,"pid":pid,"package_id":package_id,"day_no":day_no},
            success:function(data){
                if(data.status==1){
                    window.location.reload();
                }else{
                    alert(data.message);
                }
            }
        })

    }

</script>



